package com.jwm.power.repository;

import com.jwm.power.model.entity.T6Freight;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;
import java.util.List;

public interface T6FreightRepository extends JpaRepository<T6Freight, Integer>, JpaSpecificationExecutor<T6Freight> {
    // 根据当前日期查询近一个月内，使用该用户的运费
    @Query(value = "SELECT t6price FROM T6FreightDatas WHERE inquirydate BETWEEN :startDate AND :endDate AND company = :company", nativeQuery = true)
    List<T6Freight> findT6FreightByInquirydateBetweenAndCompany(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("company")String company);
}